from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
#权限
from  django.contrib.auth.models import Permission,ContentType,Group

from meiduo_admin.serializers.group_serilazer import GroupSerializer
from meiduo_admin.serializers.permision_serilazer import PermissionSerializer
from meiduo_admin.utils import PageNum

class GroupViewSet(ModelViewSet):
    queryset = Group.objects.all().order_by('id')
    pagination_class = PageNum
    serializer_class = GroupSerializer


    # 获取权限表数据
    def simple(self, reqeust):
        pers = Permission.objects.all().order_by('id')
        ser = PermissionSerializer(pers, many=True)
        return Response(ser.data)